home *** CD-ROM | disk | FTP | other *** search
/ MaxiMac 1999 December / MaxiMac 97.iso / KitWeb / Club-Internet / Hotline / Scripts Modems / Aware / PowerFax 5 / PowerFax 5
Encoding:
Text File  |  1996-02-19  |  9.8 KB  |  472 lines  |  [mlts/slnk]

  1. !  AWARE PowerFax 5
  2. !  Olivier Hamonnière for Apple Computer France
  3. !  Version : 1.1
  4. !  Date : April 29, 1994
  5. !
  6. !  'mlts' resource info for this modem:
  7. !    byte 1 == 01 -> modem HAS built-in reliability protocols
  8. !    byte 2 == 00 -> reserved by Apple
  9. !    byte 3 == 32 -> max hex chars in varstr 7 (50 dec)
  10. !    byte 4 == 32 -> max hex chars in varstr 8 (50 dec)
  11. !    byte 5 == 32 -> max hex chars in varstr 9 (50 dec)
  12. !
  13. !
  14. @ORIGINATE
  15. @ANSWER
  16. !
  17. !-------------------------------------------------------------------------------
  18. ! Set up the modem - label range is 1-10
  19. !-------------------------------------------------------------------------------
  20. !
  21. ! Mac talks to the modem at 19,200 bps.  
  22. SerReset 19200, 0, 8, 1
  23. DTRset
  24. !
  25. ! Reset the serial port handshake options
  26. HSReset 0 0 0 0 0 0
  27. !
  28. SetTries 0
  29. @LABEL 1
  30. flush
  31. matchclr
  32. matchstr 1 3 "OK\13\10"
  33. !
  34. ! &F     - Recall factory settings
  35. ! E0     - Turn command echo off
  36. ! W1     - Enable detailed error correction messages (protocol,speed,DTE speed)?
  37. ! &K3    - Enable RTS/CTS flow control
  38. ! &M0    - Asynchronous mode
  39. ! &Q6    - Normal mode, asynchronous mode
  40. ! &T5    - Disable remote test requests
  41. ! \J0    - Disable adjustment of DTE speed to line speed
  42. ! \K4    - On local break, switch to command mode
  43. ! \N0    - Enable normal mode (disable error correction)
  44. ! %C0    - Disable data compression
  45. ! -K0    - Disable protocol conversion (V42 LAPM to MNP10)
  46. ! S0=0   - Don't answer calls
  47. !          All other relevant parameters set by the AT&F command (see manual)
  48. !
  49. write "AT&F&D0E0W1&K3&M0&Q6&T5\\J0\\K4\\N0%C0-K0S0=0\13"
  50. matchread 30
  51. inctries
  52. iftries 2 71
  53. ! Modem not responding, send long break.
  54. LBreak
  55. jump 1
  56. !
  57. @LABEL 3
  58. ! Modem responding & configured.
  59. ! Determine if reliable link is requested.
  60. !
  61. ! If modem mnp10 link requested (var 4 == 2) then jump label 4
  62. ! If modem v42 link requested (var 4 == 1) then jump label 5
  63. ! If no modem v42 link requested (var 4 == 0) [same as ARA 1.0] then jump label 9
  64. !
  65. ifstr 4 4 "2"
  66. ifstr 4 5 "1"
  67. ifstr 4 9 "0"
  68. !
  69. ! Else invalid value in var 4, exit with error
  70. jump 76
  71. !
  72. @LABEL 4
  73. ! MNP10 link is requested. Enable MNP10 protocol
  74. matchclr
  75. matchstr 1 7 "OK\13\10"
  76. ! )M1   - Enable power level adjustment of cellular communications
  77. write "AT\\N3-K1)M1*H0\13"
  78. matchread 30
  79. jump 71
  80. !
  81. @LABEL 5
  82. ! Reliable link is requested.  OK for LAP-M -> MNP 4.
  83. matchclr
  84. matchstr 1 7 "OK\13\10"
  85. ! \N3   - Enable both MNP and V42 as well as normal mode
  86. write "AT\\N3\13"
  87. matchread 30
  88. jump 71
  89. !
  90. @LABEL 7
  91. ! If we DID support v42b in the modem, this is where it would go.
  92. !
  93. @LABEL 9
  94. ! If speaker on flag is true, jump to label 13.  Else turn off the speaker.
  95. ifstr 2 13 "1"
  96. pause 5
  97. matchclr
  98. matchstr 1 13 "OK\13\10"
  99. write "ATM0\13"
  100. matchread 30
  101. jump 71
  102. !
  103. !
  104. !
  105. ! Modem ready, so enable answer or dial mode - label range is 11-30
  106. ! Determine if answer or originate mode.
  107. !
  108. @LABEL 13
  109. pause 5
  110. ifANSWER 62
  111. !
  112. !-------------------------------------------------------------------------------
  113. ! Here is ORIGINATE mode. - Dialing
  114. !-------------------------------------------------------------------------------
  115. !
  116. ! Dial type dispatch
  117. !
  118. ! Normal dialing (parm 6 == 0) jump to 19
  119. ! Blind  dialing (parm 6 == 1) jump to 17
  120. ! Manual dialing (parm 6 == 2) jump to 15 
  121. !
  122. ifstr 6 19 "0"
  123. ifstr 6 17 "1"
  124. ifstr 6 15 "2"
  125. !
  126. ! Else invalid value in var 6, exit with error
  127. jump 76
  128. !
  129. !
  130. ! Manual dialing is done here
  131. @label 15
  132. note "Appel manuel . . ." 3
  133. write "ATD\13"
  134. jump 32
  135. !
  136. !
  137. ! Blind dialing is done here
  138. @label 17
  139. matchclr
  140. matchstr 1 19 "OK\13\10"
  141. write "ATX1\13"
  142. matchread 30
  143. jump 71
  144. !
  145. !
  146. ! This is where we break up long dialstrings.
  147. ! This modem has a 50 chars command buffer for dialing
  148. ! Labels 19 - 27 reserved. 
  149. !
  150. @label 19
  151. ! Parameter 1 contains the full dialstring from the connection document.
  152. ! Parameter 3 contains "P" for pulse & "T" for tone dialing.
  153. ! Parameter 7, 8 & 9 contain the dial string fragments.
  154. !
  155. note "Appel en cours : ^1" 3
  156. !
  157. ! If parm 8 is blank goto sending parm 7 only
  158. ! else send parm 7 with semicolon
  159. ifstr 8 25 " "
  160. !
  161. matchclr
  162. matchstr 1 21 "OK\13\10"
  163. matchstr 2 72 "NO DIALTONE\13\10"
  164. matchstr 3 74 "BUSY\13\10"
  165. matchstr 4 73 "ERROR\13\10"
  166. matchstr 5 77 "DELAYED"
  167. matchstr 6 79 "BLACKLISTED\13\10"
  168. write "ATD^3^7;\13"
  169. matchread 400
  170. jump 71
  171. !
  172. ! If parm 9 is blank goto sending param 8
  173. ! else send param 8 with semicolon & param 9
  174. @label 21
  175. ifstr 9 27 " "
  176. !
  177. matchclr
  178. matchstr 1 23 "OK\13\10"
  179. matchstr 2 72 "NO DIALTONE\13\10"
  180. matchstr 3 74 "BUSY\13\10"
  181. matchstr 4 73 "ERROR\13\10"
  182. matchstr 5 77 "DELAYED"
  183. matchstr 6 79 "BLACKLISTED\13\10"
  184. write "ATD^3^8;\13"
  185. matchread 400
  186. jump 71
  187. !
  188. ! Send final parameter string then wait for connect message.
  189. !
  190. @label 23
  191. write "ATD^3^9\13"
  192. jump 32
  193. !
  194. @label 25
  195. write "ATD^3^7\13"
  196. jump 32
  197. !
  198. @label 27
  199. write "ATD^3^8\13"
  200. jump 32
  201. !
  202. !
  203. !-------------------------------------------------------------------------------
  204. !    Connecting - label range is 31-60
  205. !-------------------------------------------------------------------------------
  206. !
  207. @LABEL 32
  208. matchclr
  209. matchstr 1  68 "RING\13\10"
  210. matchstr 2  72 "NO DIALTONE\13\10"
  211. matchstr 3  73 "NO CARRIER\13\10"
  212. matchstr 4  73 "ERROR\13\10"
  213. matchstr 5  74 "BUSY\13\10"
  214. matchstr 6  75 "NO ANSWER\13\10"
  215. matchstr 7  77 "DELAYED"
  216. matchstr 8  79 "BLACKLISTED\13\10"
  217. !
  218. matchstr 11 34 "CONNECT 2400\13\10"
  219. matchstr 12 35 "CONNECT 4800\13\10"
  220. matchstr 13 36 "CONNECT 7200\13\10"
  221. matchstr 14 37 "CONNECT 9600\13\10"
  222. matchstr 15 38 "CONNECT 12000\13\10"
  223. matchstr 16 39 "CONNECT 14400\13\10"
  224. !
  225. matchstr 17 40 "CARRIER 2400\13\10"
  226. matchstr 18 41 "CARRIER 4800\13\10"
  227. matchstr 19 42 "CARRIER 7200\13\10"
  228. matchstr 20 43 "CARRIER 9600\13\10"
  229. matchstr 21 44 "CARRIER 12000\13\10"
  230. matchstr 22 45 "CARRIER 14400\13\10"
  231. !
  232. matchstr 23 46 "PROTOCOL: LAP-M\13\10"
  233. matchstr 24 47 "PROTOCOL: ALT\13\10"
  234. matchstr 25 48 "PROTOCOL: ALT - CELLULAR\13\10"
  235. matchstr 26 32 "PROTOCOL: NONE\13\10"
  236. !
  237. matchread 700
  238. ! If in ANSWER mode, loop back.
  239. ! Else in ORIGINATE mode, the modem has timed out.
  240. ifANSWER 32
  241. jump 71
  242. !
  243. !
  244. !  This modem HAS been setup to do CTS handshaking
  245. !  and we assume that a CTS handshaking cable is being used.
  246. !  
  247. @LABEL 34
  248. note "Modems connectés à 2400 bps." 2
  249. CommunicatingAt 2400
  250. jump 58
  251. !
  252. @LABEL 35
  253. note "Modems connectés à 4800 bps." 2
  254. CommunicatingAt 4800
  255. jump 58
  256. !
  257. @LABEL 36
  258. note "Modems connectés à 7200 bps." 2
  259. CommunicatingAt 7200
  260. jump 58
  261. !
  262. @LABEL 37
  263. note "Modems connectés à 9600 bps." 2
  264. CommunicatingAt 9600
  265. jump 58
  266. !
  267. @LABEL 38
  268. note "Modems connectés à 12000 bps." 2
  269. CommunicatingAt 12000
  270. jump 58
  271. !
  272. @LABEL 39
  273. note "Modems connectés à 14400 bps." 2
  274. CommunicatingAt 14400
  275. jump 58
  276. !
  277. !
  278. ! Carrier connections
  279. !
  280. @LABEL 40
  281. note "Porteuse détectée à 2400 bps." 2
  282. jump 32
  283. !
  284. @LABEL 41
  285. note "Porteuse détectée à 4800 bps." 2
  286. jump 32
  287. !
  288. @LABEL 42
  289. note "Porteuse détectée à 7200 bps." 2
  290. jump 32
  291. !
  292. @LABEL 43
  293. note "Porteuse détectée à 9600 bps." 2
  294. jump 32
  295. !
  296. @LABEL 44
  297. note "Porteuse détectée à 12000 bps." 2
  298. jump 32
  299. !
  300. @LABEL 45
  301. note "Porteuse détectée à 14400 bps." 2
  302. jump 32
  303. !
  304. !
  305. ! V.42 and MNP4 link connections
  306. ! Tell ARA with USERHOOK 2 that a reliable modem link has been established.
  307. !
  308. @LABEL 46
  309. note "Liaison LAP-M fiabilisée négociée." 3
  310. userhook 2
  311. pause 20
  312. jump 32
  313. !
  314. @LABEL 47
  315. note "Liaison MNP fiabilisée négociée." 3
  316. userhook 2
  317. pause 20
  318. jump 32
  319. !
  320. !
  321. ! MNP10 link connections
  322. ! Tell ARA with USERHOOK 4 that an MNP10 modem link has been established.
  323. !
  324. @LABEL 48
  325. note "Liaison MNP10 négociée." 3
  326. userhook 4
  327. pause 20
  328. jump 32
  329. !
  330. !
  331. @LABEL 58
  332. ! set the serial port handshake options for CTS
  333. HSReset 0 1 0 0 0 0
  334. !
  335. !
  336. ! Connection established. In ORIGINATE mode pause before exit.
  337. !
  338. ifANSWER 59
  339. pause 30
  340. @LABEL 59
  341. exit 0
  342. !
  343. !
  344. !
  345. !-------------------------------------------------------------------------------
  346. ! Here is ANSWER mode initialization part
  347. !-------------------------------------------------------------------------------
  348. !
  349. ! @ANSWER
  350. ! Set the modem to answer on 2nd ring - label range is 61-70
  351. !
  352. @LABEL 62
  353. matchclr
  354. ! On match jump to MODEM STATUS and wait for RING
  355. matchstr 1 32 "OK\13\10"
  356. write "ATS0=2\\N3-K1)M1*H0\13"
  357. matchread 30
  358. jump 71
  359. !
  360. ! RING entry point
  361. ! If ORIGINATE mode return to waiting for input.
  362. ! Else claim the serial port and return.
  363. !
  364. @LABEL 68
  365. ifORIGINATE 32
  366. userhook 1
  367. note "Réponse en cours . . ." 2
  368. jump 32
  369. !
  370. !
  371. !
  372. !-------------------------------------------------------------------------------
  373. ! Error messages - label range is 71-100
  374. !-------------------------------------------------------------------------------
  375. !
  376. ! Modem Not Responding
  377. @LABEL 71
  378. exit -6019
  379. !
  380. ! No Dialtone
  381. @LABEL 72
  382. exit -6020
  383. !
  384. ! No Carrier or Error
  385. @LABEL 73
  386. exit -6021
  387. !
  388. ! Busy
  389. @LABEL 74
  390. exit -6022
  391. !
  392. ! No Answer
  393. @LABEL 75
  394. exit -6023
  395. !
  396. ! Invalid Varstring Value
  397. @LABEL 76
  398. exit -6027
  399. !
  400. ! Delayed Number (blacklisted)
  401. @LABEL 77
  402. exit -6002 "Numéro momentanément interdit."
  403. !
  404. ! Number forbidden (blacklisted)
  405. @LABEL 78
  406. exit -6002 "Numéro définitivement interdit.\13Réinitialisez le modem pour réutiliser ce numéro."
  407. !
  408. ! Blacklist full
  409. @LABEL 79
  410. exit -6002 "La liste des numéros interdits est pleine.\13Réinitialisez le modem."
  411. !
  412. ! Abort
  413. @LABEL 80
  414. exit -6002 "Abandon de l'action en cours."
  415. !
  416. !
  417. !
  418. !-------------------------------------------------------------------------------
  419. ! Hang up the modem - label range is 101-120
  420. !-------------------------------------------------------------------------------
  421. !
  422. @HANGUP
  423. !
  424. @LABEL 102
  425. flush
  426. SerReset 19200,0,8,1
  427. settries 0
  428. HSReset 0 0 0 0 0 0
  429. !
  430. @LABEL 105
  431. ! Drop the modem into command mode with escape sequence.
  432. ! Then tell modem to hangup.
  433. ! Repeat hangup command and escape sequence 3 times max.
  434. !
  435. flush
  436. matchclr
  437. matchstr 1 108 "OK\13\10"
  438. pause 10
  439. write "+++"
  440. matchread 15
  441. !
  442. @LABEL 108
  443. matchclr
  444. matchstr 1 111 "NO CARRIER\13\10"
  445. matchstr 2 111 "OK\13\10"
  446. matchstr 3 111 "ERROR\13\10"
  447. write "ATH0\13"
  448. matchread 30
  449. inctries
  450. iftries 3 71
  451. DTRClear
  452. jump 105
  453. !
  454. ! recall the factory setting.
  455. !
  456. @LABEL 111
  457. SerReset 19200,0,8,1
  458. matchclr
  459. matchstr 1 114 "OK\13\10"
  460. write "AT&F\13"
  461. matchread 30
  462. jump 71
  463. !
  464. @LABEL 114
  465. DTRset
  466. exit 0
  467. !
  468. !-------------------------------------------------------------------------------
  469. !
  470. ! Labels 121-128 are reserved for future emergency hacks.
  471. !